import { BasicColumn } from '/@/components/Table';

export const columns: BasicColumn[] = [
  {
    title: '客户端ID',
    dataIndex: 'clientId',
  },
  {
    title: '客户端地址',
    dataIndex: 'clientIp',
  },
  {
    title: '节点IP',
    dataIndex: 'nodeIp',
  },
  {
    title: '保持会话',
    dataIndex: 'cleanSession',
    slots: { customRender: 'keepSession' },
  },
  {
    title: '状态',
    dataIndex: 'state',
    slots: { customRender: 'state' },
  },
  {
    title: '协议类型',
    dataIndex: 'protocolType',
    slots: { customRender: 'protocolType' },
  },
  {
    title: '用户名',
    dataIndex: 'username',
    customRender: ({ record }) => {
      return record.auth.username;
    },
  },
  {
    title: '心跳(秒)',
    dataIndex: 'keepalive',
  },
  {
    title: '连接时间',
    dataIndex: 'connectTime',
  },
];

export const columns1: BasicColumn[] = [
  {
    title: '订阅主题',
    dataIndex: 'dyzt',
  },
  {
    title: '服务等级',
    dataIndex: 'fwdj',
  },
];

export const searchFormSchema: FormSchema[] = [
  {
    field: 'clientId',
    label: '客户端ID',
    component: 'Input',
    colProps: { span: 6 },
  },
  {
    field: 'clientIp',
    label: '客户端地址',
    component: 'Input',
    colProps: { span: 6 },
  },
  {
    field: 'nodeIp',
    label: '节点IP',
    component: 'Input',
    colProps: { span: 6 },
  },
  {
    field: 'protocolType',
    label: '协议类型',
    component: 'Select',
    colProps: { span: 6 },
    //填写组件的属性
    componentProps: {
      options: [
        { label: 'MQTT', value: 'MQTT' },
        { label: 'COAP', value: 'COAP' },
        { label: 'MQTT_WEBSOCKET', value: 'MQTT_WEBSOCKET' },
        { label: 'V2C', value: 'V2C' },
        { label: 'GBT32960', value: 'GBT32960' },
        { label: 'I1', value: 'I1' },
        { label: 'MQTTS', value: 'MQTTS' },
        { label: 'WEBSOCKET', value: 'WEBSOCKET' },
      ],
    },
  },
];
